﻿using Microsoft.OpenApi.Models;
using Volo.Abp;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;

namespace Student.ApiHost
{
    [DependsOn(
        typeof(AbpSwashbuckleModule)
    )]
    public class StudentSwaggerModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.AddAbpSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo { Title = "Student API", Version = "v1" });
                options.DocInclusionPredicate((docName, description) => true);
                options.CustomSchemaIds(type => type.FullName);
            });
        }

        public override void OnApplicationInitialization(ApplicationInitializationContext context)
        {
            var app = context.GetApplicationBuilder();
            app.UseStaticFiles();
            app.UseSwagger();
            app.UseAbpSwaggerUI(options =>
            {
                options.SwaggerEndpoint("/swagger/v1/swagger.json", "Student API");
            });
        }
    }
}